package com.auxgroup.smarthome.controller;

import com.auxgroup.smarthome.filter.annotation.PermissionFilter;
import com.auxgroup.smarthome.syscode.Syscode;
import com.auxgroup.smarthome.web.ApiResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

/**
 * Created by kevinchen on 2016/12/27.
 */
@Api(tags = "系统状态")
@RestController
public class SystemController {

    @ApiOperation(value = "所有错误码")
    @GetMapping(value = "/errorcode")
    @PermissionFilter(filter = true)
    public ApiResponse getAllCode(){
        String errcode = Arrays.toString(Syscode.values());
        return ApiResponse.ok(errcode.substring(1, errcode.length()-1).split(","));
    }


}
